home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 5.3 KB | 149 lines | [TEXT/GEOL] |
- Item 5322435 22-Nov-88 05:49
-
- From: UK0004 Bacchus & Smith, Paul Smith
-
- To: ANDRIEUX1 Euro Dev Svcs, Alain Andrieux
-
- cc: MACAPP.TECH$ MACAPP Tech
- UK.DEVSERV UK - Product Mktg, J Rose
-
- Sub: MacApp & Background servers
-
-
- From: Dave Jewell, Bacchus & Smith Limited, England
-
-
- MultiFinder Server problems
- ===========================
-
- We are developing, using as a basis a foreground-only AppleTalk server
- application we developed some time ago, a background server which sits
- in it's own MultiFinder "world" and functions both as an Appletalk-based
- server and also makes a number of services available to other applications
- running on the same Macintosh. The server has no user interface or windows
- of it's own: it reports to the user via the Notification Manager.
-
- The existing server is in use in a number of European sites, and supports
- 10 to 20 concurrent users on a LocalTalk network, providing comprehensive
- (and very fast) B-Tree Indexed File handling services to several large-scale
- applications we have developed using MacApp.
-
- The server was developed using MPW C 2.0.2. A fully developed calling interface
- for MacApp 1.1.1 exists and is proven in real live applications (regarding
- recent correspondence in MACAPP.TECH$: if anyone wants to licence this
- technology, please 'link us at UK0004).
-
- We first thought that by enabling the AppleTalk 'self-send' bit and running
- the server on the same machine as the MacApp client application, both under
- MultiFinder, that we would have an acceptable system. We expected that there
- would be some loss of performance, but the first problem struck...
-
-
- First Problem
- -------------
-
- If the server is packaged as a regular application, it does not get *any*
- processor time when another application is active. We therefore set
- the server's SIZE resource as follows:
-
- resource 'SIZE' (-1) {
- dontSaveScreen,
- ignoreSuspendResumeEvents,
- enableOptionSwitch,
- canBackground,
- notMultiFinderAware,
- onlyBackground,
- dontGetFrontClicks,
- 384 * 1024,
- 384 * 1024
- };
-
- This is the same combination of SIZE bits as is used by Backgrounder.
- (Backgrounder, which looks after Print Monitor, is the closest existing
- application to what we want to achieve.)
-
- The problem is that the server now gets time, but only a *very* limited
- amount. We call WaitNext event with an eventmask of 0 (like Backgrounder).
-
- I have put in a temporary piece of code to invert a screen pixel after
- each WaitNextEvent call and we only seem to get called maybe 4 or 5 times
- a second. Altering the sleep parameter to WaitNextEvent makes no
- significant difference.
-
- I would have expected that if the active application has no pending
- events, then MultiFinder would call the background app much more often.
- It does not seem to do this. Four or five times a second is enough for
- Backgrounder but not for us. With the server running so slowly, both
- remote (i.e. Appletalk requests) and local requests run **very** slowly.
-
- Accordingly, we decided to try to provide direct communication between
- the server and the foreground application. This is where the second
- problem arose...
-
-
- Second Problem
- --------------
-
- We now want our own applications to be able to make direct calls to the server
- on the same machine. We need the other apps to be able to "find" the
- server and call routines within it. I have written code which swops the
- A5 register, etc and this works OK. BUT we need a future-proof mechanism
- which enables programs to talk to one another under MultiFinder.
-
- One method that works is to use the unassigned exception vector at location
- $30 in low memory: changing the value in this vector to point to a jump
- instruction which in turn points where the original vector originally pointed.
- This means that if the vector ever gets used by Apple or Motorola it will
- still work. My application code looks for a signature *after* the jump
- instruction. Now, I know this is absolutely against all Guidelines but:
-
- a) At least I haven't grabbed an unassigned A-Trap
- b) I haven't touched what's on the stack so anything that looks at
- stack return addresses etc *won't* break.
- c) My client does not want the expense of writing a driver.
- d) It works.
-
- Needless to say I would like someone to recommend a more future-proof
- (and A/UX-proof) technique.
-
-
- Inter-Application Communication under MultiFinder
- -------------------------------------------------
-
- Surely Apple should consider putting a real mechanism for inter-application
- communication into MultiFinder. I suggest that each application register
- it's own unique name under MultiFinder. Then another application could go
- try and start a "conversation" with "EXCEL" for example. (This sort of idea
- is similar to DDE under Microsoft Windows.)
-
- I could see MultiFinder inter-process communication, one day, working
- something like this:
-
- MFRegisterName ("SQLSERVER");
-
- for (;;)
- {
- /* this routine yields control until we get a request */
-
- client = MFWaitForRequest (¶mblock);
- .
- .
- .
- Process request
- .
- .
- .
- MFSendReply (¶mblock, client);
- }
-
-
- Thoughts, anyone??
-
-
- Regards,
- Dave Jewell
- -----------
-
-
-
-